package LeetCode;

public class LC_645_SetMismatch {

    public static void main(String[] args) {

    }

    public class Solution {
        public int[] findErrorNums(int[] nums) {
            int res[] = new int[2];
            boolean map[] = new boolean[nums.length + 1];
            for (int num : nums)
                if (!map[num])
                    map[num] = true;
                else
                    res[0] = num;
            for (int i = 1; i < (nums.length + 1); i++)
                if (!map[i]) {
                    res[1] = i;
                    break;
                }
            return res;
        }
    }

}